static int findnicklogin( char *nick, struct nicksave *to, BPTR f )
{
while( FRead( f, to, sizeof( *to ), 1 ) == 1 )
{
if( !stricmp( to->nick, nick ) )
return( TRUE );
}
return( FALSE );
}
static int findnicksave( char *nick, struct nicksave *to )
{
BPTR f = Open( fn_dat, MODE_READWRITE );
struct nicksave ns;
if( !f )
return( FALSE );
SetVBuf( f, 0, BUF_FULL, 32 * sizeof( ns ) );
if( findnicklogin( nick, to, f ) )
{
Close( f );
return( TRUE );
}
Close( f );
return( FALSE );
}
static void handlecmd( char *fromuser, int priv, char *cmd )
{
char *p = stpbrk( cmd, " \t," );
struct cmd *cmn;
int pri = getuserpri( fromuser );
if( !stricmp( fromuser, mynick ) )
return;
if( p )
{
*p++ = 0;
p = stpblk( p );
}
else
p = "";
if( !stricmp( cmd, "STATUS" ) )
{
char x[á6 ];
struct nicksave ns;
if( *p && pri >= 99 )
{
if( !findnicksave( p, &ns ) )
{
answer( fromuser, priv, "Sorry, no status for %s available.\n", p );
return;
}
utunpk( ns.created, x );
answer( fromuser, priv, "%s has logged in %ld times. I've first seen that user on %02ld-%02ld-%04ld. Since then, he has been online for %ld days, %ld hours and %ld mins. His average online time per login is ~%ld minutes, counting %ld logins i've tracked.",
answer( fromuser, priv, "Your status is %ld. This is the first time that i have seen you.", pri, ns.count );
}
else
{
utunpk( ns.created, x );
answer( fromuser, priv, "Your status is %ld. You've logged in %ld times. I've first seen you on %02ld-%02ld-%04ld. Since then, you have been online for %ld days, %ld hours and %ld mins. Your average online time per login is ~%ld minutes, counting %ld logins i've tracked.",